#!/bin/bash
# WFH CLI 启动脚本 - 自动加载项目配置

cd "$(dirname "$0")"

# 加载项目配置
if [ -f .gemini/.env ]; then
    export $(grep -v '^#' .gemini/.env | xargs)
    echo "✅ 已加载配置: .gemini/.env"
else
    echo "⚠️  未找到配置文件: .gemini/.env"
fi

# 启动 WFH CLI
if command -v wfh-cli &> /dev/null; then
    wfh-cli "$@"
elif [ -f ~/.nvm/versions/node/v22.17.1/bin/wfh-cli ]; then
    ~/.nvm/versions/node/v22.17.1/bin/wfh-cli "$@"
else
    echo "❌ 未找到 wfh-cli 命令"
    echo "请先运行: npm install -g ."
fi
